package br.com.registrofinancas.adapters;

import br.com.registrofinancas.R;
import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class SplashScreenAdapter extends PagerAdapter{

	private static final int NUM_PAGES = 2;
	private static final int PRIMEIRA_TELA = 0;
	private static final int INFO = 1;
	private LayoutInflater inflater;
	
	
	
	public SplashScreenAdapter(Context context) {
		super();
		this.inflater = LayoutInflater.from(context);		
		Log.i("INFO", "Construindo SplashScreenAdapter");
	}
	
	
	@Override
	public Object instantiateItem(ViewGroup container, int position) {
		View viewInfo = inflater.inflate(R.layout.activity_informacoes, null);
		View viewPrimeiraTela = inflater.inflate(R.layout.activity_primeira_tela, null);
		Log.i("INFO", "Position:" + position);
		if(position == 0){
			container.addView(viewPrimeiraTela);
			return viewPrimeiraTela;
		}else{
			container.addView(viewInfo);		
			return viewInfo;
		}		
		
	}



	@Override
	public int getCount() {
		Log.i("INFO", "Numero de pagins SplashScreen:" + NUM_PAGES);
		return NUM_PAGES;	
	}
	
	

	@Override
	public boolean isViewFromObject(View view, Object obj) {
		return view == obj;
	}

}
